import { createRouter, createWebHashHistory } from "vue-router";
import Home from '../components/HelloWorld.vue'
import About from "@/components/About.vue";
import { navData } from '@/untils/nav'

const routes = [
    {
        path: '/',
        name: 'Home',
        component: Home,
    },
    {
        path: '/about',
        name: 'About',
        component: About
    },
];

navData.forEach(element => {
    routes.push({
        path: element.path,
        name: element.name,
        component: () => import('../' + element.component)
    });
});

const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router;
